package com.example.provider.aop.aspects;

import com.example.provider.aop.TestBefore;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Service;

/**
 * Description
 *
 * @author zhuwenqiang
 * @data
 */

@Aspect
@Service
public class TestBeforeAspect {

    @Pointcut("@annotation(testBefore)")
    public void doBefore(TestBefore testBefore) {

    }

    @Before("doBefore(testBefore)")
    public void before(JoinPoint joinPoint,TestBefore testBefore){
        if (testBefore.testInt()==1){
            System.out.println("在执行方法前执行"+ joinPoint);
        }
    }
}
